#ifndef TOOLMOVEMENTFCN_H_
#define TOOLMOVEMENTFCN_H_

#include "fmtxlib.h"
#include "Minuit2/FCNBase.h"
#include <vector>
#include <cassert>
#include <list>
#include <cmath>
#include <iostream>

class ToolMovementFCN : public ROOT::Minuit2::FCNBase
{
public:
	ToolMovementFCN() 
	{
		m_errorDef = 0.25;
	}
	~ToolMovementFCN() {}

	void Init(const std::list<fmath::vector3>& A, const std::list<float>& b);
	double operator()(const std::vector<double>& a_lambda) const;
	std::vector<double> Gradient(const std::vector<double>& a_lambda) const;

	void SetErrorDef(double errDef) { m_errorDef = errDef; }
	bool CheckGradient() const {return false;}
	double Up() const { return m_errorDef; }
	
protected:
	double m_errorDef;
	std::vector<double> m_b;
	std::vector<std::vector<double>> m_H;
};

#endif //TOOLMOVEMENTFCN_H_